package com.cskaoyan.controller.statistics;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.statistics.BaseStatisticsVO;
import com.cskaoyan.service.statistics.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:统计报表
 * @author: Jason 805636901@qq.com
 * @create: 2021-10-20-10:49 PM
 */
@RestController
@RequestMapping("admin/stat")
public class StatisticsController {

    @Autowired
    StatisticsService statisticsService;


    //@RequestMapping("user")
    //public String getUser() {
    //    return "{\"errno\":0,\"data\":{\"columns\":[\"day\",\"users\"],\"rows\":[{\"day\":\"2019-04-20\",\"users\":1}]},\"errmsg\":\"成功\"}";
    //}
    @RequestMapping("user")
    public BaseRespVo user() {
        return BaseRespVo.ok(statisticsService.getUserData());
    }

    //@RequestMapping("order")
    //public String getOrder() {
    //    return "{\"errno\":0,\"data\":{\"columns\":[\"day\",\"orders\",\"customers\",\"amount\",\"pcr\"],\"rows\":[{\"amount\":3650.90,\"orders\":7,\"customers\":1,\"day\":\"2021-09-26\",\"pcr\":3650.90},{\"amount\":2994.90,\"orders\":8,\"customers\":1,\"day\":\"2021-09-27\",\"pcr\":2994.90}]},\"errmsg\":\"成功\"}";
    //}
    @RequestMapping("order")
    public BaseRespVo order() {
        return BaseRespVo.ok(statisticsService.getOrderData());
    }

/*
    @RequestMapping("goods")
    public String getGoods() {
        return "{\"errno\":0,\"data\":{\"columns\":[\"day\",\"orders\",\"products\",\"amount\"],\"rows\":[{\"amount\":7280.90,\"orders\":13,\"day\":\"2021-09-26\",\"products\":20},{\"amount\":2993.90,\"orders\":8,\"day\":\"2021-09-27\",\"products\":12},{\"amount\":459.00,\"orders\":1,\"day\":\"2021-09-29\",\"products\":1},{\"amount\":999.00,\"orders\":1,\"day\":\"2021-10-01\",\"products\":1},{\"amount\":48.00,\"orders\":2,\"day\":\"2021-10-20\",\"products\":8}]},\"errmsg\":\"成功\"}";
    }*/
    @RequestMapping("goods")
    public BaseRespVo goods() {
        return BaseRespVo.ok(statisticsService.getGoodsData());
    }


}
